﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UniMana.Utils.Controls;

namespace UniMana.Data
{
    public class Training_ClassInfo
    {
        #region /*Không thay đổi*/
        public bds m_bds = new bds();
        public void Save()
        {
            m_data.m_DCSave.SubmitChanges();
        }
        public void Delete()
        {
            m_bds.DeleteCurrent();
        }
        #endregion /*Không thay đổi*/
        private DBMain m_data = new DBMain();

        public Training_Class Properties
        {
            get { return m_bds.Current as Training_Class; }
        }

        public Training_ClassInfo(string _strClassID = "")
        {
            var IQuery = m_data.m_DCSave.Training_Classes.Where(p => p.ID == _strClassID);
            this.m_bds.DataSource = IQuery;
            var Row = IQuery.FirstOrDefault();
            if (Row == null)
            {
                Row = new Training_Class();
                m_bds.Add(Row);
            }
        }

        public Training_ClassInfo(int _iClassKey)
        {
            var IQuery = m_data.m_DCSave.Training_Classes.Where(p => p.Training_ClassKey == _iClassKey);
            this.m_bds.DataSource = IQuery;
            var Row = IQuery.FirstOrDefault();
            if (Row == null)
            {
                Row = new Training_Class();
                m_bds.Add(Row);
            }
        }

        #region Chi --Hòa
        private bool m_bExist = true;

        public bool ExistInDataBase
        {
            get { return this.m_bExist; }
        }
        #endregion

        #region [An]

        #endregion
    }
}
